Cloudflare Storage & Compute Demo — Cheat Sheet

~10–12 min · Five services, one Worker, one URL · "Italic quotes" = phrases, your words are better · ▶ = action

Before the call

First time? Read this once, then never again.

Three things you'll touch during this demo. Each takes 30 seconds to set up.

1. Opening the D1 Console (the SQL editor)

This is a web-based SQL editor built into Cloudflare. No installs needed.

  1. Open https://dash.cloudflare.com/ff89748ca36e597848348d987fc25108/workers/d1
  2. You'll see a list with one database. Click "demo-d1-database".
  3. At the top of the page you'll see tabs. Click the "Console" tab.
  4. A big text box appears. That's where you paste SQL.
  5. Type SELECT * FROM Customers; and click Execute. You should see 5 rows below.

Now leave this tab open. During the demo you'll switch to it and paste new queries.

2. Running wrangler tail (the live log streamer)

This shows logs from your Worker in real-time. Used during the Queues demo to prove messages are flowing.

  1. Open Terminal (Cmd+Space, type "Terminal")
  2. Run these two commands:
cd ~/Library/CloudStorage/GoogleDrive-dburke@cloudflare.com/My\ Drive/cf-demo-app
wrangler tail

You'll see "Connected to cf-demo-app, waiting for logs..." When you click buttons on the demo page, log lines appear here. Leave this terminal window visible — you'll point at it during the demo.

3. The demo page itself

Just a URL. Buttons trigger API calls; results show as JSON.

  1. Open https://cf-demo-app.dustinburke23nc.workers.dev/
  2. You'll see five colored cards (D1, R2, Vectorize, Queues, Hyperdrive) with buttons on each.
  3. Click any button — a new tab opens with the JSON response from that service.

That's it. Three browser tabs and one terminal window. You're ready.

0. Open (~1 min)

"Workers is the compute layer — you've seen what one Worker can do. But Workers alone is just code. To build a real application, you also need storage, databases, queues, and ways to connect to data you already have. Cloudflare has all of that built in. Let me show you five services that turn Workers into a real application platform, with one Worker tying them all together."

▶ Switch to the live app: https://cf-demo-app.dustinburke23nc.workers.dev/

"This is one Worker — about 300 lines of code, deployed globally. It uses five different Cloudflare storage and compute products, each represented by a card on the page. Every button hits a real API endpoint. Let me walk through each."

1. D1 — Serverless SQL (~2 min)

▶ Click List Customers — JSON response opens in a new tab

"D1 is Cloudflare's serverless SQL database — SQLite under the hood, globally distributed with read replicas. You see five customer rows. Real data, real query, real database. No instance to provision, no port to open, no monthly minimum. The button hit a Worker, the Worker queried D1, you got JSON back."

▶ Click Filter by UK

"Same database, filtered query — WHERE Country = 'UK'. Real SQL, not a NoSQL pretender."

Switch to the D1 Console

▶ Switch to the D1 Console browser tab you opened earlier

Paste this query, click Execute

SELECT c.CompanyName, c.Country,
       COUNT(o.OrderId) AS orders,
       SUM(o.Amount) AS lifetime_value
FROM Customers c
LEFT JOIN Orders o ON c.CustomerId = o.CustomerId
GROUP BY c.CustomerId
ORDER BY lifetime_value DESC;
"Joins, aggregates, ordering — all the SQL you'd expect. Production-ready. Every row update propagates to read-replicas around the world automatically — no ops, no read-replica management."
Bridge line: "Great, we have structured data. But what about files — images, PDFs, video, backups? That's R2."

2. R2 — Object Storage (~2.5 min)

Show it working (45 sec)

▶ Click View Image Gallery — a visual page opens with images rendering

"Every image you see on this page is being fetched live from R2 — Cloudflare's object storage. The Worker called env.BUCKET.get() for each one and streamed the bytes back to your browser. No CDN tricks, no signed URLs, no API calls. R2 is just a binding, like a database connection."
"R2 is S3-compatible — anything that talks to AWS S3 talks to R2 unchanged. Same SDK, same CLI tools, same authentication model. The aws-sdk, rclone, Cyberduck — they all just work."

Let the customer upload (45 sec)

▶ Click the orange "Upload your own file →" button at the bottom of the gallery

→ A drag-and-drop page opens. Hand them control: "Drag any file from your desktop — image, PDF, anything under 100 MB."

"What just happened: your browser sent that file as multipart form data to the Worker, the Worker called env.BUCKET.put() — one line of code — and R2 returned a success. The whole upload took ~100ms, and the file is immediately accessible at a public URL. No CORS dance, no presigned URL generation, no SDK config. This is one of the most-asked-about S3 patterns turned into one line."

⏸ Now the punchline. Go back to the gallery and scroll to the yellow cost box.

The egress story (60 sec)

"Here's why every developer I talk to gets excited about R2: zero egress fees. The yellow box on the gallery page does the math live — these images served a million times a month would cost roughly $12-15 on AWS S3, $20 on Vercel Blob, and $0 on R2. Forever. No per-GB charges to download your own files."
"That's why customers move image hosting, video, AI training data, and backup workloads to R2. The savings aren't a percentage — they're 100% of the egress line item. For any business serving significant media or files, R2 pays for itself in the first month."
Bridge line: "We've got SQL data, we've got files. Now — what about AI? What about semantic search? That's Vectorize."

3. Vectorize — Vector Database (~2 min)

Set up the concept (30 sec)

"Vectorize is Cloudflare's vector database — same category as Pinecone or Weaviate. It's what powers semantic search and the 'R' in RAG, Retrieval Augmented Generation. In plain terms: it's the storage layer that lets an LLM search your private documents by meaning, not by keyword. Every AI feature that needs to 'know your data' uses one of these."

Run it (45 sec)

▶ Click Search: "fast database" — results appear below as JSON

"My query is 'fast database.' Notice: none of my documents contain those exact words. A traditional keyword search returns zero. Vectorize returns the top match: Hyperdrive at 0.75 similarity — 'Hyperdrive accelerates queries to your existing Postgres database.' Second: D1 at 0.65 — 'D1 is Cloudflare's serverless SQL database.' The system understood that 'fast' relates to 'accelerate' and 'database' relates to both products, with no keyword matching at all. That's the premise of semantic search and RAG."

Land the payoff (30 sec)

"This is how you build a search engine over your own knowledge base — your internal wiki, your product documentation, your customer support history. It's how you build a chatbot that actually knows your product instead of hallucinating about it. And the entire flow you just watched — embedding the query, searching the index, returning ranked results — ran in one Worker call with two Cloudflare service bindings. No Pinecone API key, no OpenAI embedding bill, no separate vector database to operate."
Bridge line: "Sometimes Workers don't need to respond to the user immediately — they need to do work in the background. That's Queues."

4. Queues — Async Messaging (~1.5 min)

Set up the concept (30 sec)

"Queues are the platform's answer to 'do work in the background.' Every real application needs this — when a user submits a form, you don't want them waiting while your code sends emails, processes uploads, calls slow third-party APIs, or runs AI inference. You write the message to a queue, return the response immediately, and a separate handler processes the work asynchronously. Cloudflare Queues are bundled with Workers — no separate service, no separate billing, no separate SDK."

Run it (45 sec)

▶ In your pre-opened terminal, run wrangler tail

▶ Back to the browser · Click Send Message three or four times

"Each click sent a JSON message to a Cloudflare Queue and got an instant success response. The user never waits for the actual work. Now watch the terminal — the consumer processes them in a batch."
What the terminal looks like:
$ wrangler tail Connected to cf-demo-app, waiting for logs... GET .../queue/send - Ok @ 11:42:01 GET .../queue/send - Ok @ 11:42:02 GET .../queue/send - Ok @ 11:42:03 GET .../queue/send - Ok @ 11:42:04 [Queue Consumer] Received message abc-123: {...} [Queue Consumer] Received message def-456: {...} [Queue Consumer] Received message ghi-789: {...} [Queue Consumer] Received message jkl-012: {...}

Land the payoff (30 sec)

"The top lines are the producer — every form submission, returned to the user immediately. The bottom lines are the consumer — Cloudflare batched all four messages together and called my handler once. That batching is automatic, and so is retry logic and dead-letter queue handling if a message fails. One Worker file contains both the producer that writes to the queue and the consumer that processes from it. Compare to SQS or Kafka — separate service, separate billing, separate IAM, separate SDK. Here it's two lines of code: env.QUEUE.send() to produce, and an async queue() handler to consume."
Bridge line: "Now — the objection I hear most often. 'We already have a database in AWS. We've invested in it. We're not migrating to D1.' Totally fair. That's exactly what Hyperdrive solves."

5. Hyperdrive — Postgres Accelerator (~3 min — this is the closer)

"Hyperdrive doesn't replace your database. It accelerates it. We pool connections to your existing Postgres or MySQL — anywhere — at the Cloudflare edge. We cache read queries. We eliminate the seven round-trips it normally takes just to connect before you can send your first query. This Worker is connected to a Postgres database on Neon, in us-east-1 — let me show you both paths side by side."

▶ Click Sample Query first to make sure Hyperdrive is warmed up

The Race — Direct vs Hyperdrive

▶ Click Race: Direct vs Hyperdrive (the red button on the Hyperdrive card)

What the JSON response looks like (numbers vary):
{ "test": "Hyperdrive vs Direct PostgreSQL Connection", "iterations": 5, "direct": { "label": "Direct connection (no pooling, no caching)", "connectMs": 40, // SLOW: full handshake every time "queryTimingsMs": [3, 3, 3, 2, 3], "totalMs": 54 }, "hyperdrive": { "label": "Cloudflare Hyperdrive (pooled and cached)", "connectMs": 2, // FAST: pooled connection "queryTimingsMs": [39, 4, 1, 2, 1], "totalMs": 49 }, "summary": { "speedup": "5.8x faster with Hyperdrive", "connectionSavings": "38ms saved on connection setup", "cacheBenefit": "First query: 39ms, cached: 1ms" } }
"What you're seeing: the same query against the same database, but on the left a direct Postgres connection — what your code would do normally. On the right — through Hyperdrive."

→ Walk the screen top-to-bottom

▶ Click the button again — second run is the punchline

"Notice the bottom of the response — '5.8x faster with Hyperdrive'. And remember — this database is on the same continent. For a database in Europe being read from Asia, Hyperdrive turns 200ms into 5ms."
"And we didn't change a single line of database code. The driver is the same. The SQL is the same. The credentials are the same. One environment variable change — point at Hyperdrive's connection string — and your app gets faster."
Bridge line: "One more — and it's the one I save for AI-heavy customers. What happens when OpenAI goes down? That's AI Gateway."

6. AI Gateway — Fallback Routing (~2 min · skip if no AI workload)

Set up the problem (30 sec)

"Last year OpenAI had a four-hour outage. Anthropic had outages too. Every LLM provider has incidents. If your app calls these APIs directly, your app goes down with them. AI Gateway sits between your code and any AI provider — when the primary fails or rate-limits, traffic automatically flows to a fallback. Your users never see the outage."

Show the happy path (30 sec)

▶ Click Fallback Demo button on the landing page · click Happy path (primary works)

"This is the normal day. Primary model — Llama 3.1 — answers in ~450ms. Green check. Fallback is skipped. Customer gets their answer."

Now break it (60 sec — the wow)

▶ Click 💥 Break the primary → watch fallback

"I'm going to force the primary model to fail on purpose. In production, this would happen automatically when OpenAI returns a 503, or hits a rate limit, or has an outage. For the demo I'm simulating that failure so we can watch the fallback kick in. Same code path, same outcome — I'm just triggering it manually."
"Watch what happens. Same prompt. Same gateway. Same code."

→ Point at the screen as it updates

"Primary card just lit up red — '503 Service Unavailable.' That's me simulating OpenAI being down. But the user still got a response. The fallback card kicked in — different model, came back in ~420ms — and the response was delivered. The user has no idea anything failed. Zero downtime."
The big idea: "Same code. Same prompt. The infrastructure decided which model to use based on health. That's what AI Gateway does — plus caching, rate limiting per user, observability across every LLM provider, all in one dashboard. It's the layer every production AI app needs."

The Payoff — One Worker, Six Services (~1 min)

Recap — six products, one Worker

"All bound to one Worker. One URL. One bill. One dashboard. Cloudflare isn't a CDN with bolt-on developer products — it's a complete application platform that also happens to be the world's largest CDN."

Close (~1 min)

"If you've got an application running anywhere — AWS, GCP, Vercel, anywhere — odds are at least one of these five services replaces something you're paying way more for. Egress fees alone usually justify R2. You don't have to migrate everything. You just have to start."
If they're sold: "I can stand up a proof of concept on your data this week. Pick the biggest itch — usually R2 or Hyperdrive — and we wire it up."

If they're cautious: "Open the demo URL on your phone. Forward it to your team. The proof is in clicking the buttons."
THE STORAGE & COMPUTE POINT

Workers is the compute. D1, R2, Vectorize, Queues, Hyperdrive are how it becomes an application.
One platform. One bill. One dashboard. No data egress fees. No connection juggling.
Your existing database — kept where it is — made fast.

"Compute alone is a buzzword. Compute plus storage plus data plus AI — bound together at the edge — is an architecture."

If something breaks during the demo


Quick Answers — back-pocket

Is D1 actually production-ready?

Yes. GA since April 2024. Read replicas for low-latency global reads. 10GB per database, multiple databases per account. If you outgrow it, Hyperdrive lets you move to Postgres without rewriting your Worker code.

How is R2 different from S3?

Two big things: (1) zero egress fees — no per-GB charge for downloads. (2) S3-compatible API, so existing tools work unchanged. Same durability (11 nines), same eventual consistency model.

What's the catch with Vectorize?

No catch. Free tier: 30 million queried vector dimensions per month. Paid: $0.04 per million stored, $0.01 per million queried. Compare to Pinecone — usually 5–10× cheaper, and the embeddings can be generated for free with Workers AI.

Why use Queues instead of just calling the API directly?

Three reasons: (1) the user gets a fast response — Worker returns immediately, work happens later. (2) Retries are automatic — if the consumer fails, the message goes back on the queue. (3) Batching — process 10 messages at once for efficiency.

Does Hyperdrive work with my database?

Postgres, MySQL, and any compatible flavor — Neon, Supabase, RDS, Aurora, PlanetScale, CockroachDB, Materialize. If it speaks the Postgres or MySQL wire protocol, Hyperdrive works.

How does Hyperdrive caching not return stale data?

You control it. Default cache TTL is 60 seconds, configurable down to zero (no cache). Hyperdrive understands SQL — INSERT/UPDATE/DELETE bypass the cache automatically. Cache only applies to deterministic SELECT queries.

Where does the data live geographically?

D1 has a primary region with read replicas globally. R2 is regional with global access. Vectorize is global. Queues are regional. Hyperdrive pools connections globally but your origin DB stays put. Data Localization Suite available for compliance.

Can I see this code?

Yes — entire Worker is ~300 lines of TypeScript. Five service bindings in one wrangler.jsonc. Happy to share the repo.

Pricing for all five together?

All five have generous free tiers. A small production app — say 1M requests/month, 10GB R2 storage, 1M Vectorize queries, 1M queue messages, Hyperdrive on top of an existing DB — runs ~$5–15/month. Heavy usage scales linearly.